package com.taoxi.good.service.Impl;

import com.taoxi.common.utils.DateUtils;
import com.taoxi.good.domain.GoodWholesaler;
import com.taoxi.good.mapper.GoodWholesalerMapper;
import com.taoxi.good.service.IGoodWholesalerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 批发商商品Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-24
 */
@Service
public class GoodWholesalerServiceImpl implements IGoodWholesalerService {
    @Autowired
    private GoodWholesalerMapper goodWholesalerMapper;

    /**
     * 查询批发商商品
     *
     * @param id 批发商商品主键
     * @return 批发商商品
     */
    @Override
    public GoodWholesaler selectGoodWholesalerById(Long id) {
        return goodWholesalerMapper.selectGoodWholesalerById(id);
    }

    /**
     * 查询批发商商品列表
     *
     * @param goodWholesaler 批发商商品
     * @return 批发商商品
     */
    @Override
    public List<GoodWholesaler> selectGoodWholesalerList(GoodWholesaler goodWholesaler) {
        return goodWholesalerMapper.selectGoodWholesalerList(goodWholesaler);
    }

    /**
     * 新增批发商商品
     *
     * @param goodWholesaler 批发商商品
     * @return 结果
     */
    @Override
    public int insertGoodWholesaler(GoodWholesaler goodWholesaler) {
        goodWholesaler.setCreateTime(DateUtils.getNowDate());
        return goodWholesalerMapper.insertGoodWholesaler(goodWholesaler);
    }

    /**
     * 修改批发商商品
     *
     * @param goodWholesaler 批发商商品
     * @return 结果
     */
    @Override
    public int updateGoodWholesaler(GoodWholesaler goodWholesaler) {
        goodWholesaler.setUpdateTime(DateUtils.getNowDate());
        return goodWholesalerMapper.updateGoodWholesaler(goodWholesaler);
    }

    /**
     * 批量删除批发商商品
     *
     * @param ids 需要删除的批发商商品主键
     * @return 结果
     */
    @Override
    public int deleteGoodWholesalerByIds(Long[] ids) {
        return goodWholesalerMapper.deleteGoodWholesalerByIds(ids);
    }

    /**
     * 删除批发商商品信息
     *
     * @param id 批发商商品主键
     * @return 结果
     */
    @Override
    public int deleteGoodWholesalerById(Long id) {
        return goodWholesalerMapper.deleteGoodWholesalerById(id);
    }
}
